package physics.Collisions;



import globals.ObjectType;
import physics.Avatar;
import physics.Bomb;
import physics.Carrot;
import physics.GameObject;
import physics.GiantRobot;
import physics.Grenade;
import physics.Knife;
import physics.LavaSphere;
import physics.Missile;
import physics.Planet;
import physics.PortalEntrance;
import physics.Robot;

public class Collision {
	
	GameObject obj1;
	GameObject obj2;
	ObjectType type;

	public Collision(GameObject object, GameObject object2) {
		obj1 = object;
		obj2 = object2;
		setType();
	}
	
	private void setType(){
		
		type = ObjectType.DEFAULT;
		
		if ((obj1 instanceof Planet) || (obj2 instanceof Planet)){
			type = ObjectType.PLANET;
		}
		
		if ((obj1 instanceof Avatar) || (obj2 instanceof Avatar)){
			type = ObjectType.AVATAR;
		}
		
		if ((obj1 instanceof Bomb) || (obj2 instanceof Bomb)){
			type = ObjectType.BOMB;
		}
		
		if ((obj1 instanceof Carrot && obj2 instanceof Avatar) ||
			     (obj1 instanceof Avatar && obj2 instanceof Carrot)){
				type = ObjectType.CARROT;
		}
		
		if ((obj1 instanceof Knife && obj2 instanceof Avatar) ||
			     (obj1 instanceof Avatar && obj2 instanceof Knife)){
				type = ObjectType.KNIFE;
		}
		
		
		if ((obj1 instanceof PortalEntrance && obj2 instanceof Avatar) ||
			      (obj1 instanceof Avatar && obj2 instanceof PortalEntrance)){
			type = ObjectType.PORTAL;
		}
		
		if ((obj1 instanceof Carrot && obj2 instanceof Robot) ||
			     (obj1 instanceof Robot && obj2 instanceof Carrot)){
				type = ObjectType.CARROTROBOT;	
		}
		
		if ((obj1 instanceof Avatar && obj2 instanceof Robot) ||
			     (obj1 instanceof Robot && obj2 instanceof Avatar)){
				type = ObjectType.AVATARROBOT;	
		}
		
		if ((obj1 instanceof Avatar && obj2 instanceof GiantRobot) ||
			     (obj1 instanceof GiantRobot && obj2 instanceof Avatar)){
				type = ObjectType.AVATARGIANTROBOT;	
		}
		
		if ((obj1 instanceof Missile && obj2 instanceof Robot) ||
			     (obj1 instanceof Robot && obj2 instanceof Missile)){
				type = ObjectType.MESSILEROBOT;	
		}
		
		if ((obj1 instanceof LavaSphere) || (obj2 instanceof LavaSphere)){
			type = ObjectType.LAVAPLANET;
		}
		
		if (obj1 instanceof Grenade  || obj2 instanceof Grenade){
			type = ObjectType.GRENADE;
		}
		
		
	
	}

	public GameObject getObj1() {
		return obj1;
	}

	public void setObj1(GameObject obj1) {
		this.obj1 = obj1;
	}

	public GameObject getObj2() {
		return obj2;
	}

	public void setObj2(GameObject obj2) {
		this.obj2 = obj2;
	}

	public ObjectType getType() {
		return type;
	}
		
}
